package top.szhome.system.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import top.szhome.framework.starter.db.support.SimpleServiceImpl;
import top.szhome.system.convert.ParamConverter;
import top.szhome.system.dto.ParamDTO;
import top.szhome.system.entity.Param;
import top.szhome.system.mapper.ParamMapper;
import top.szhome.system.service.ParamService;
import top.szhome.system.vo.ParamVO;

/**
 * 系统参数 服务实现
 *
 * @author 唐加利
 * @date 2023/07/31
 **/
@AllArgsConstructor
@Service
@Slf4j
public class ParamServiceImpl extends SimpleServiceImpl<ParamMapper, ParamConverter, ParamDTO, Param, ParamVO> implements ParamService {

    @Override
    public ParamVO getByCode(String code) {
        Param param = getBaseMapper().selectOne(Wrappers.lambdaQuery(Param.class).eq(Param::getCode, code));
        return getBaseConvert().to(param);
    }
}
